package org.enwey.icarenew.Adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import org.enwey.icarenew.Component.TopicHeaderItem;
import org.enwey.icarenew.Model.Comment;

import java.util.List;

/**
 * Created by John on 2/7/2015.
 */
public class TopicHeaderAdapter extends BaseAdapter {
    private Context context;
    private List<Comment> mCommentList;

    public TopicHeaderAdapter(Context context) {
        this.context = context;
    }

    public void setCommentList(List<Comment> list) {
        this.mCommentList = list;
    }

    @Override
    public int getCount() {
        return (mCommentList != null ? mCommentList.size() :0);
    }

    @Override
    public Object getItem(int position) {
        return (mCommentList != null ? mCommentList.get(position) : null);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        TopicHeaderItem item = null;
        if (convertView != null) {
            item = (TopicHeaderItem) convertView;
        }else {
            item = new TopicHeaderItem(context);
        }
//        item.setDate(mCommentList.get(position-1));
        return item;
    }
}
